<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Resource Timing in dedicated workers</title>
<link rel="author" title="Google" href="http://www.google.com/" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webperf/tests/resources/webperftestharness.js"></script>
<script src="/webperf/tests/resources/webperftestharnessextension.js"></script>
<link rel="stylesheet" href="/resources/testharness.css" />
<script>
setup({explicit_done: true});

var worker_requested_resources = [
    '/webperf/tests/resources/generate_resource.php?type=image&id=1',
    '/webperf/tests/resources/generate_resource.php?type=image&id=2',
];

var worker = new Worker("/webperf/tests/resources/loader_worker.js");

worker.onmessage = function(event) {
    var context = new PerformanceContext(window.performance);
    var entries = context.getEntriesByType('resource');
    test_equals(entries.length, 6, "There should be six entries: 4 scripts, 1 stylesheet, and the worker itself");
    done();
}

function start() {
    worker.postMessage(worker_requested_resources);
}

window.addEventListener("load", start);
</script>
</head>
<body>
<h1>Description</h1>
<p>This test validates that resources requested by dedicated workers don't appear in the main document.</p>

<div id="log"></div>

</body>
</html>
